﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="publish.aspx.cs" Inherits="weikebuluo.web.wechat.market.publish" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
<link  rel="stylesheet"  href="style/new.css?v=1">
<link  rel="stylesheet"  href="style/common.css">
    <script src="../../../scripts/JQuery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.form-validator.min.js"></script>
<script src="/Scripts/AjaxUpload.3.5.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="style/main.css" />

<script type="text/javascript">
    Array.prototype.in_array = function (e) {
        for (i = 0; i < this.length; i++) {
            if (this[i] == e)
                return true;
        }
        return false;
    }
    document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
        WeixinJSBridge.call('hideToolbar');
        WeixinJSBridge.call('hideOptionMenu');
    });
</script>
<title>微客服务市场</title>
</head>
<body>
    <form action="publish.aspx" id="newthread" method="POST" enctype="multipart/form-data">
<div>
</div>
<div>
</div>
    <div class="body">
<div class="head">
    <a class="return" href="#">发布</a>
</div>

<div>
	<ul class="page_pic_emotion clear" id="nav_page">
		<li class="page_pic on" id="page_pic">
			<dl>
				<dd>
					<img id="simg" src="" />
                    <input type="hidden" name="pimg" id="himg" style="height:28px;width:224px;" />
				</dd>
				<dt>
                <input type="button" id="insert_bg" value="上传图片" style="width: 82px;height: 43px;background-color: #1DCFC8;color:#fff;" id="select">
					<label>最多可上传1张图片</label>
				</dt>
			</dl>
		</li>
	</ul>
</div>

<div class="inf">
<%if (!string.IsNullOrEmpty(Request.QueryString["uid"]))
  { %>
  <input type="hidden" name="uid" value="<%=Request.QueryString["uid"] %>" />
  <input type="hidden" name="wxid" value="<%=Request.QueryString["wxid"] %>" />
  <%} %>
    <input name="title" type="text" id="title" placeholder="物品" data-validation="required" data-validation-length="min20" data-validation-error-msg="请输入物品" />
</div>
<div class="inf">
    <input name="price" type="text" id="price" placeholder="定价￥" data-validation="number" data-validation-error-msg="请输入价格" value="" />
</div>
<div class="inf">
    <input name="name" type="text" id="name" placeholder="联系人" data-validation="required" data-validation-error-msg="请输入联系人姓名" />
</div>
<div class="inf">
    <input name="phone" type="text" id="phone" placeholder="联系电话" data-validation="required" data-validation-error-msg="请输入联系电话" />
</div>
<div class="inf">
<span id="max-length-element">1000</span> 
<span>字</span>
    <textarea name="content" rows="2" cols="20" id="content" placeholder="添加描述" data-validation="required" data-validation-error-msg="请输入描述">
</textarea>
</div>
<div style="padding-top:40px"></div>
<div class="subbox">

    <input type="submit" name="subPub" value="立即发布" id="subPub" class="sub" />
</div>
<input type="hidden" name="action" value="add" /></form>
</div>
<script>
    $.validate();
    $('#content').restrictLength($('#max-length-element'));
 </script>
<script type="text/javascript">
    function check() {
        var title = $('#title').val();
        var price = $('#price').val();
        var name = $('#name').val();
        var phone = $('#phone').val();
        var content = $('#content').val();
        if (title == "") {
            alert('标题不可为空!');
            return false;
        }
        else if (content == "") {
            alert('内容不可为空!');
            return false;
        }
        else if (price == "") {
            alert('报价不可为空!');
            return false;
        }
        else if (name == "") {
            alert('联系人不可为空!');
            return false;
        }
        else if (phone == "") {
            alert('联系电话不可为空!');
            return false;
        }
        alert(1);
        return false;
    }
    </script>
    
<script type="text/javascript">
    new AjaxUpload($("#insert_bg"), {
        action: '/Controllers/Ashx/upload.ashx?p=market&dir=image',
        name: 'imgFile',
        onSubmit: function (file, ext) {
            if (!(ext && /^(jpg|png|jpeg|gif)$/.test(ext))) {
                $.messager.alert('错误提示', '只能上传 JPG, PNG 或 GIF 类型的文件！', 'info');
                return false;
            }
        },
        onComplete: function (file, response) {
            response = eval("(" + response + ")");
            if (response.error != "0") {
                alert(response.message);
            } else {
                document.getElementById("simg").setAttribute("src", response.url);
                document.getElementById("himg").setAttribute("value", response.url);
            }
        }
    });
</script>

<div class="footer">微客网络工作室荣誉出品</div>
    </form>
</body>
</html>
